package com.sf.fy.uav.common.utils;


import java.util.Date;

/**
 * 前端标准返回格式
 * <p>
 * http status 永远 200
 *
 * @param <T>
 */
public class FloResponseModel<T> {


    public FloResponseModel() {
    }

    public FloResponseModel(T data) {
        this.data = data;
    }

    private Integer code = 200;

    private T data;

    private Boolean success = true;

    private String msg = "OK";

    private Date currentServerTime = new Date();

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public Date getCurrentServerTime() {
        return currentServerTime;
    }

    public void setCurrentServerTime(Date currentServerTime) {
        this.currentServerTime = currentServerTime;
    }

    /**
     * 操作成功时返回的数据
     *
     * @param data
     * @param <E>
     * @return
     */
    public static <E> FloResponseModel<E> success(E data) {
        return new FloResponseModel<>(data);
    }

    /**
     * 操作成功时返回的数据
     *
     * @param <E>
     * @return
     */
    public static <E> FloResponseModel<E> success() {
        return new FloResponseModel<>(null);
    }

}
